# encoding = utf-8
import pandas as pd

from application.logging import logger
from application.utils.CodeTimingUtil import CodeTimingUtil
from application.utils.MySQLUtils import MySQLUtils


@CodeTimingUtil(name="读取模型表数据:read_station_id_model_name")
def read_station_id_model_name():
    """
    获取模型数据:热力站编号和模型名称
    :return:
    """
    # 查询语句 FIXME 暂时先只查询有数据的一个站 station_id=1353374478217908224
    sql = f"SELECT DISTINCT station_id, model_name FROM sn_control_hotstation_model where station_id = '1353374478217908224'"
    logger.info(f"查询语句[热力站模型]:\n {sql}")
    # 获取连接
    con = MySQLUtils.get_mysql_connection()
    # 查询数据
    df = pd.read_sql_query(sql=sql, con=con)
    logger.info(f"查询结果[热力站模型]:\n {df}")
    # 筛选排序
    df = df[["station_id", "model_name"]]
    logger.info(f"筛选排序[热力站模型]:\n {df}")
    # 返回结果
    return df
    pass


if __name__ == '__main__':
    read_station_id_model_name()
    pass
